<?php

namespace App\Admin\Forms\Settings;

use App\Models\SettingsModel;
use Illuminate\Filesystem\Cache;
use Illuminate\Http\Request;

class Ticket extends BaseTabForm
{
    /**
     * The form title.
     *
     * @var string
     */
    public $title = '工单设置';

    /**
     * Handle the form request.
     *
     * @param Request $request
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function handle(Request $request)
    {
        parent::handle($request);
        admin_success('Processed successfully.');

        return back();
    }

    /**
     * Build a form here.
     */
    public function form()
    {
        $this->text('max_deal', '最大处理数')->rules('required')->help('客服最大同时处理的工单数，超过该数目则不会分配给该客服');
    }

    /**
     * The data of the form.
     *
     * @return array $data
     */
    public function data()
    {
        return [
            'max_deal'       => SettingsModel::getSetting('max_deal'),
        ];
    }
}
